import React, { Component } from 'react';

import MpUrl from '@/route/getparam';
import './detail.scss';
import { getAccountDetail } from '@/api/user';

export default class AccountDetail extends Component{
	constructor (props) {
		super(props)
		this.state = {
			data: {}
		}
	}
	componentDidMount () {
		let getUrl = new MpUrl()
		this.setState({
			account_user_id: getUrl.get('account_user_id'),
			employee_id: getUrl.get('employee_id')
		}, () => {
			getAccountDetail({account_user_id: getUrl.get('account_user_id'), employee_id:  getUrl.get('employee_id')}).then(res => {
				this.setState({
					data: res.data
				})
			})
		})
	}
	render () {
		return (
			<div className="account-detail">
				<div className="account-title">
					已成为你的客户{this.state.data.start_date}天
				</div>
				<div className="account-message-group">
					<div className="account-message">
						<div className="account-message--title">
							来源：
						</div>
						<div className="account-message--content">
							来自扫码
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							备注名：
						</div>
						<div className="account-message--content">
							{this.state.data.account_name}
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							性别：
						</div>
						<div className="account-message--content">
							{this.state.data.sex === 1 ? '男' : '女'}
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							手机号码：
						</div>
						<div className="account-message--content">
							{this.state.data.mobile}
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							邮箱：
						</div>
						<div className="account-message--content">
							{this.state.data.email}
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							公司：
						</div>
						<div className="account-message--content">
							{this.state.data.account_company_name}
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							详细地址：
						</div>
						<div className="account-message--content">
							{this.state.data.address}
						</div>
					</div>
					<div className="account-message">
						<div className="account-message--title">
							生日：
						</div>
						<div className="account-message--content">
							{this.state.data.birthday}
						</div>
					</div>
				</div>
			</div>
		)
	}
}
